﻿@using System.Web.Mvc.Ajax
@using System.Web.Mvc.Html
@using nanoCMS.Forum.WebUI.Models.AdminViewModels
@using nanoCMS.Forum.WebUI.Models.ViewModels
@model MoveThreadVM


@using (Ajax.BeginForm("MoveThreadSave", "ForumAdmin", new { }, new AjaxOptions { OnSuccess = "OnSuccess", HttpMethod = "post", UpdateTargetId = "admin_content" }, new { }))
{
    <input type="hidden" name="ThreadID" id="ThreadVM_ThreadID" value="@(Model.Thread.ThreadID)"/>
    <fieldset id="">
        <div>
            <label for="ThreadVM_ForumID">
                Choose new forum</label>
            <select id="ThreadVM_ForumID" name="ForumID">
                <option value="0">-- none --</option>
                @foreach (var item in Model.ForumDisplay)
                {
                    Html.RenderPartial("ForumSelectBoxPartial", item);
                }
            </select>
        </div>
        <div>
            <input type="submit" value="Submit" />
        </div>
    </fieldset>  
}


<!-- TODO move to .js --> 
<script type="text/javascript">
    jQuery(document).ready(function() {
        // select current (edit) parent forum
        selectForum(); 
    });
    function selectForum() {
        var parentForumID = @(Model.Thread.ForumID);
        jQuery("#ThreadVM_ForumID").val(parentForumID);    
    }
</script>
